package com.cloud.hystrix.service;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;

import com.cloud.hystrix.entity.Person;
import com.cloud.hystrix.service.PersonBaseUserService.PersonBaseUserServiceFallback;

@FeignClient(name = "Invoker-and-Provider", fallback = PersonBaseUserServiceFallback.class)
public interface PersonBaseUserService {
	@GetMapping(value = "/getPerson", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	public Person getPerson();

	@Component
	static class PersonBaseUserServiceFallback implements PersonBaseUserService {
		@Override
		public Person getPerson() {
			Person person = new Person();
			person.setUrl("this is Hystrix+Feign error msg!");
			return person;
		}

	}
}
